<ui:composition template = "template.xhtml"
                xmlns ="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">
    <ui:define name ="conteudo">

        <h:button value="Novo Campo" outcome="novoCampo" />
        
        <h2>Lista de Campos</h2>
        
        <h:dataTable value="#{campos.campos}" var="campo">
            
            <h:column>
                <h:link value="#{campo.titulo}" outcome="mostraCampo" >
                    <f:param name="chave" value="#{campo.chaveCampo}" />
                </h:link> 
            </h:column>
            
            <h:column>
                <h:link value="Edita" outcome="editaCampo" >
                    <f:param name="chave" value="#{campo.chaveCampo}" />
                </h:link> 
            </h:column>
            
            <h:column>
                <h:form>
                    <h:commandLink value="Deleta" action="#{campos.delete()}" >
                        <f:param name="chave" value="#{campo.chaveCampo}" />
                    </h:commandLink> 
                </h:form>
            </h:column>
            
        </h:dataTable>
        
    </ui:define>
</ui:composition>